package test.y2020;

import cn.hutool.core.lang.Console;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * Created By  醉美柳舞之众星捧月
 *
 * @author song
 * @date 2020/7/3 17:53
 */
public class July3 {

    public static void main(String[] args) {

        @Data
        @Accessors(chain = true)
        class produces {

            private String warehouse;
            private String productName;

        }
        List<produces> list = new ArrayList<>(16);
        list.add(new produces().setWarehouse("成都1号仓").setProductName("苹果"));
        list.add(new produces().setWarehouse("成都2号仓").setProductName("苹果"));
        list.add(new produces().setWarehouse("成都1号仓").setProductName("香蕉"));

        Console.error(list);

        Map<String, List<String>> collect = new HashMap<>();

        /*    Map<"成都1号仓", Arrays.as("苹果","香蕉")>   */
        /*    Map<"苹果", Arrays.as("成都1号仓","成都2号仓")>   */


        final Map<String, List<produces>> collect1 = list.stream().collect(Collectors.groupingBy(produces::getProductName));

    }

}
